﻿//----------------------------------------------------------------
// Copyright (c) 2011-2013 
// All rights reserved.
// Author: Ben DaoWei 
// Contact: bendaowei@gmail.com
// Web Link: http://xnaeditor.codeplex.com
// ----------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace UnityEngine.Terrain
{
    public struct VertexPositionNormalTextureFogBones : IVertexType
    {
        public Vector3 Position;
        public Vector3 Normal;
        public Vector2 TextureCoordinate;
        public Vector4 Index;
        public float Fog;
        //public Vector3 Tanget;
        //public Vector3 Binormal;

        public static readonly VertexDeclaration VertexDeclaration = new VertexDeclaration
        (
            new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
            new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0),
            new VertexElement(24, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0),
            new VertexElement(32, VertexElementFormat.Vector4, VertexElementUsage.BlendIndices, 0),
            //new VertexElement(32, VertexElementFormat.Vector3, VertexElementUsage.Tangent, 0),
            //new VertexElement(44, VertexElementFormat.Vector3, VertexElementUsage.Binormal, 0)
            new VertexElement(48, VertexElementFormat.Single, VertexElementUsage.Fog, 0)
        );

        public static readonly int SizeInBytes = sizeof(float) * (3 + 3 + 2 + 4 + 1);

        VertexDeclaration IVertexType.VertexDeclaration
        {
            get { return VertexPositionNormalTextureFogBones.VertexDeclaration; }
        }
    }
}
